package com.alibaba.aone.casestudy.dao.impl;

import java.util.List;

import com.alibaba.aone.casestudy.common.entity.Action;
import com.alibaba.aone.casestudy.common.entity.ActionConditions;
import com.alibaba.aone.casestudy.dao.ActionDao;
import com.alibaba.intl.commons.framework.ibatis.BaseSqlMapClientDaoSupport;

public class ActionDaoImpl extends BaseSqlMapClientDaoSupport implements
		ActionDao {

	public void addAction(Action action) {

	}

	public Action getActionByNo(String actionNo) {
		return (Action) this.getSqlMapClientTemplate().queryForObject(
				"ACTION.selectAction", actionNo);
	}

	public List<Action> listActions() {
		/*return (List<Action>) this.getSqlMapClientTemplate()
				.queryForPagination("ACTION.countAction", "ACTION.selectAll",
						conditions);*/
		return getSqlMapClientTemplate().queryForList("ACTION.selectAll");
	}

	public int updateAction(Action action) {
		return this.getSqlMapClientTemplate().update("ACTION.updateAction",
				action);
	}

	public List<Action> getActionsByCasestudyNo(String casestudyNo) {
		return this.getSqlMapClientTemplate().queryForList(
				"ACTION.selectActionsByCasestudyNo", casestudyNo);
	}

	public List<Action> search(ActionConditions actionConditions) {

		return getSqlMapClientTemplate().queryForPagination(
				"ACTION.countAction", "ACTION.actionSearch", actionConditions);
	}

}